package com.pointstar.dp.modules.project.service.impl;

import com.pointstar.dp.common.entity.Page;
import com.pointstar.dp.common.entity.Query;
import com.pointstar.dp.modules.project.dao.InOutBoundDetailsMapper;
import com.pointstar.dp.modules.project.entity.dto.ProductOutDetailsDTO;
import com.pointstar.dp.modules.project.service.InOutBoundDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 出库主表
 * @author Korey<m13057531285@163.com>
 */
@Service("inOutBoundDetailsService")
public class InOutBoundDetailsServiceImpl implements InOutBoundDetailsService {


	private final InOutBoundDetailsMapper inOutBoundDetailsMapper;

	@Autowired
	public InOutBoundDetailsServiceImpl(InOutBoundDetailsMapper inOutBoundDetailsMapper) {

		this.inOutBoundDetailsMapper = inOutBoundDetailsMapper;
	}


	@Override
	public Page<ProductOutDetailsDTO> productOutDetails(Map<String, Object> params) {
		String inProductId = params.get("inProductId").toString();
		String[] args = inProductId.split("\\.");
		params.put("inBoundId",args[0]);
		params.put("productId",args[1]);

		Query query = new Query(params);
		Page<ProductOutDetailsDTO> page = new Page<>(query);
		inOutBoundDetailsMapper.listForPage(page, query);
		return page;
	}

	/*@Override
	public List<ProductOutDetailsDTO> productOutDetailsNoPage(Map<String, Object> params) {
		return null;
	}*/
}
